/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kpython.backend.semantic;

/**
 *
 * @author Dinis
 */
public class Type {

    private String type;

    private Type(String aType) {
        this.type = aType;
    }
    
    public Type ()
    {}

    @Override
    public String toString() {
        return this.type;
    }
    //Simple types
    public static final Type unknownType = new Type("NoneType");
    public static final Type intType = new Type("integer");
    public static final Type floatType = new Type("float");
    public static final Type stringType = new Type("String");
    //List types
    public static final Type listUnknownType = new Type("NoneTypeList");
    public static final Type listIntType = new Type("integerList");
    public static final Type listFloatType = new Type("floatList");
    public static final Type listStringType = new Type("StringList");
    
    public static final Type getListType(Type aSimpleType) {
        return new Type(aSimpleType.toString()+"List");
    }

    //public static final SemType boolType = new SemType("boolean");
    @Override
    public boolean equals(Object aType){
        if(aType == null) return false;
        return ((Type) aType).toString().equals(this.type);
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 59 * hash + (this.type != null ? this.type.hashCode() : 0);
        return hash;
    }
}
